import OpenOPC
import json
def readJSON():
    file = "make_data.json"
    try:
        t = open(file).read()
        data = json.loads(t)
    except Exception, e:
         with open(file) as flow:
             data = flow.read()
             data2 = data.replace("\n","")
             data3 = data2.replace(" ","")
             data = json.loads(data3)
    return data

data = readJSON()
opc = OpenOPC.open_client(data["collector"]["opc_server_ip"])
opc.connect(data["collector"]["opc_name"])
taglist = data["collector"]["opc_items"][:]
print opc.read(taglist[0:])
